package com.m.IO.Chars;

import java.io.*;

/**
 * PrintWriter
 * 字符过滤流
 * 封装了print()/println()方法，支持写入后换行
 *
 * @author Mc.Chai
 * @program: Java基础
 * @create 2021-11-22-17:39 17:39
 */
public class TestPrintWriter {
    public static void main(String[] args) throws IOException {
        FileWriter fileWriter=new FileWriter("print.txt");
        PrintWriter printWriter=new PrintWriter(fileWriter);
        printWriter.println("每次一输出一行");
        printWriter.println("每次一写出一行");
        printWriter.println("每次一写出一行");
        printWriter.close();
        FileReader fileReader=new FileReader("print.txt");
        BufferedReader bufferedReader=new BufferedReader(fileReader);


        while (true){
            String s=bufferedReader.readLine();
            if (s==null) break;
            System.out.println(s);
        }
    }
}
